Field of the Invention
The present disclosure generally relates to image processing and, more particularly, to an image processing apparatus, an image processing method, and a storage medium that can extract an original document region included in an image and can correct a distortion of the extracted region. The present disclosure further relates to a related image processing method and a storage medium.
Description of the Related Art
Portable terminals, such as recent smartphones and tablet personal computers (PCs), having highly advanced image processing functions become popular. Such a portable terminal is equipped with a camera having an image capturing function (i.e., a camera function). The camera function of such a portable terminal is available to capture an image of, for example, a paper document. The captured document image (i.e., image data) can be stored in a memory of the portable terminal. Further, it is feasible to transmit the captured image data to a printer and cause the printer to perform a printing operation. In other words, the portable terminal can be combined or associated with a printer to copy a target object. Even in a situation where a user does not have a multi function peripheral (MFP), i.e., an image processing apparatus having both a scanner function and a printer function, it is feasible to copy an original document when both the portable terminal and the printer are available as mentioned above.
In a document image capturing operation performed with a portable terminal using the above-mentioned camera function, it is usually difficult to capture a front image of the entire document without causing any distortion in the captured entire image, compared to the case where the document is scanned by the MFP. Therefore, it is necessary to prepare a pedestal or a tripod to fix the portable terminal and the original document (i.e., a photographing target). Otherwise, accurately maintaining the distance or the angle between the camera and the original document is difficult. Further, directly copying the thus captured image or storing a data file of the thus captured image is not desirable because a photographed image may include a noise component other than the original document image or the document image may be geometrically deformed, for example, when the image has been captured in an oblique direction. In such a case, it is necessary to extract only an original document image region (i.e., i.e., an original document region) from the captured image before performing the copy operation or storing the data file, and remove geometrical distortions by applying a distortion correction (which may be referred to as “trapezoidal correction”) to the extracted document region.
As a method for extracting an original document region from a captured image, there is a conventional method for automatically detecting four edges of the original document region (i.e., edges respectively constituting end portions of an original document) with reference to edge information obtained from the captured image so that the burden of a user can be reduced. However, the automatic detection of the edges constituting the original document region may be failed, for example, if an intended edge of the original document region cannot be detected due to a lower contrast between the original document region and a background region surrounding the original document, or if many edges other than the four edges of the original document region are detected and the intended edge cannot be appropriately determined.
In this case, the method includes identifying a quadrilateral constituted by line segments, which are determined as being possibly the edges of the original document region, from an assembly of line segments detected as the edges of the original document region, and superimposing the identified quadrilateral on an input image. The method includes accepting a user operation to correct the positions of the four edges because it is necessary to designate an accurate original document region.
Further, as a method for enabling a user to designate a quadrilateral region, it is conventionally known to set vertices of a quadrilateral and correction handles positioned at midpoints of respective edges and accept a mouse or touch operation performed by the user. According to the above-mentioned method, the user can move a vertex or an edge to an arbitrary position by operating the corresponding handle.
Further, there is a conventional method for enabling a user to select the position of a desired vertex or edge from candidates having been acquired beforehand instead of directly designating the vertex position or the edge position. As discussed in Japanese Patent Application Laid-Open No. 2007-52670, it is conventionally known to obtain a plurality of contour candidates and enable a user to select and designate a desired contour candidate from the sequentially presented contour candidates.
However, according to the above-mentioned technique, when a user inputs a plurality of images and performs a correction operation for an original document image included in each image, it is necessary for the user to perform an operation to correct the positions of four edges of original document images included in respective images.
Therefore, it is necessary for a user to perform processing for designating an accurate region for each original document image included in the plurality of images. The correction operation requires a significant amount of work and becomes complicated.